package com._21cn.cms.site.service;

import com._21cn.framework.base.db.BaseDao;
import com._21cn.framework.base.service.impl.BaseServiceImpl;

import com._21cn.cms.site.dao.ConfigDao;
import com._21cn.cms.site.entity.Config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service("configService")
public class ConfigService extends BaseServiceImpl<Config> {
	
    @Autowired
    private ConfigDao configDao;

    @Override
    protected BaseDao<Config> getBaseDao() {
        return configDao;
    }

    public Config getConfig(Integer siteId, Integer channelId, Integer columnId, String key){
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("eqSiteId", siteId);
        params.put("eqChannelId", channelId);
        params.put("eqColumnId", columnId);
        params.put("eqKey", key);
        List<Config> list = super.getList(params, 1, 1 );
        if(list!=null && list.size()>0){
            return list.get(0);
        }
        return null;
    }
}